class_name BattleOverUI

extends Panel

enum Type { WIN, LOSE}
@onready var label: Label = %Label
@onready var continue_button: Button = %ContinueButton
@onready var restart_button: Button = %RestartButton

func _ready() -> void:
	continue_button.pressed.connect(Events.do_battle_won)
	restart_button.pressed.connect(get_tree().change_scene_to_file.bind(AutoLoader.MAIN_MENU_FILE))
	Events.battle_over_request.connect(_on_battle_over_request)
	
func _on_battle_over_request(text: String, type: int) -> void:
	continue_button.visible = type == Type.WIN
	restart_button.visible = type == Type.LOSE
	label.text = text
	show()
	get_tree().paused = true
